home *** CD-ROM | disk | FTP | other *** search
- #include "stdafx.h"
-
- #include "PalDlg.h"
-
- #include "resource.h"
-
- UINT WINAPI PltGetHelpID()
- {
- return IDD_PALDLG;
- }
-
- BSTR WINAPI PltGetDescription()
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- CString cstrDesc;
- cstrDesc.LoadString(IDS_DESCRIPTION);
-
- return cstrDesc.AllocSysString();
- }
-
- BSTR WINAPI PltGetName()
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- CString cstrName;
- cstrName.LoadString(IDS_NAME);
-
- return cstrName.AllocSysString();
- }
-
- IDispatch* WINAPI PltGetPicture(BOOL bLargeButton, BOOL bMonochrome)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- LPTSTR IDB = 0;
-
- if (bLargeButton)
- {
- IDB = MAKEINTRESOURCE(IDB_PLT32);
- }
- else
- {
- IDB = MAKEINTRESOURCE(IDB_PLT16);
- }
-
-
- IDispatch *pIPictDisp = NULL;
-
- HBITMAP hbmpPal = ::LoadBitmap(AfxGetResourceHandle(), IDB);
-
- PICTDESC pict;
- pict.cbSizeofstruct = sizeof(pict);
- pict.picType = PICTYPE_BITMAP;
- pict.bmp.hbitmap = hbmpPal;
- pict.bmp.hpal = NULL;
-
- VERIFY(SUCCEEDED(OleCreatePictureIndirect(&pict, IID_IDispatch, TRUE, (void**)&pIPictDisp)));
- /*
- #ifdef _DEBUG
- IPicture* pIPict = NULL;
- OLE_YSIZE_HIMETRIC height = 0;
- OLE_XSIZE_HIMETRIC width = 0;
- pIPictDisp->QueryInterface(IID_IPicture, (void**)&pIPict);
- if (pIPict != NULL)
- {
- pIPict->get_Height(&height);
- pIPict->get_Width(&width);
- pIPict->Release();
- }
- #endif
- */
- return pIPictDisp;
- }
-
- HINSTANCE MyGetResourceHandle();
-
- HWND WINAPI PltCreateWindow(HWND hwndParent, long nID)
- {
- // AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- HINSTANCE hResOld = AfxGetResourceHandle();
- AfxSetResourceHandle(MyGetResourceHandle());
-
- HWND hwndPal = NULL;
-
- CPalDlg *pDlg = new CPalDlg;
- CWnd *pParentWnd = CWnd::FromHandle(hwndParent);
-
- if (pDlg->Create(IDD_PALDLG, pParentWnd))
- hwndPal = pDlg->GetSafeHwnd();
-
-
- AfxSetResourceHandle(hResOld);
-
- return hwndPal;
- }
-